# 此模块进行数据校验
import yaml
from dataclasses import dataclass

@dataclass
class Environment:
    address: str
    host: str
    url: str
    # zzz: str
    # 选填 有默认值
    zzzz: dict = None

def verify_yaml(yamldata: dict):
    ee = Environment(**yamldata)
    return ee

def load_some(path):
    with open(path) as f:
        return yaml.safe_load(f)
s = verify_yaml(load_some('/Users/show/PythonAndQA(code)/python-study2025/6_requests/project/bysms/config/environment.yaml')['test_environment'])
print(s)
print(type(s.host))